/*
 * Copyright (c) 2010 MoSync AB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef MAINTERPETER_ABSTRACTINTERPRETER_H
#define MAINTERPETER_ABSTRACTINTERPRETER_H

namespace MAInterpreter
{

/**
 * Super class for interpreters. The protocol of this class
 * is intended to be an interpreter-independent interface
 * that can be used when implementing different languages.
 */
class AbstractInterpreter
{
public:
	AbstractInterpreter();
	virtual ~AbstractInterpreter();
	virtual int initialize() {};
	virtual void close() {};
	virtual int runScript(const char* script) = 0;
	virtual void onInit() {};
	virtual void onDraw() {};
	virtual void onClockTick() {};
	virtual void onTouchDown(int x, int y) {};
	virtual void onTouchUp(int x, int y) {};
	virtual void onTouchDrag(int x, int y) {};
	virtual void onKeyDown(int keyCode) {};
	virtual void onKeyUp(int keyCode) {};
	virtual void setClockMillisecondInterval(int milliseconds);
	virtual int getClockMillisecondInterval();
	virtual void mainLoop();

private:
	/**
	 * The time between frames. Zero means that the clock is not running.
	 */
	int clockMillisecondInterval;
};

}

#endif
